{% extends 'cms/cms_base.html' %}

{% block title %}添加用例{% endblock %}

{% block head %}
    <script src="{{ static("cms/js/caseManage.js") }}"></script>
    <link rel="stylesheet" href="{{ static('cms/css/caseManage.css') }}">
{% endblock %}

{% block page_title %}添加用例{% endblock %}

{% block main_content %}
    <form action="" method="post" class="form-container">
        <div class="form-group addcase_class">
            <div class="input-group">
                <span class="input-group-addon"><a>*</a>用例名称</span>
                <input type="text" maxlength="50" class="form-control" name="case_name" placeholder="用例名称，最多50个字符">
            </div>
        </div>
        <div class="form-group addcase_class">
            <div class="input-group">
                <span class="input-group-addon"><a>*</a>请求URL</span>
                <textarea type="text" maxlength="1000" class="form-control" name="case_url" placeholder="请求的URL，必须符合http地址的格式要求，最多1000个字符"></textarea>
            </div>
        </div>
        <div class="form-group addcase_class">
            <div class="input-group">
                <span class="input-group-addon">请求参数</span>
                <textarea type="text" maxlength="2000" class="form-control" name="case_param" placeholder="请求的参数，最多2000个字符"></textarea>
            </div>
        </div>
        <div class="form-group addcase_class">
            <div class="input-group">
                <span class="input-group-addon"><a>*</a>请求方法</span>
                <select class="form-control" name="request_method" id="request_method" style="width: 80px;">
                    <option value="post">post</option>
                    <option value="get">get</option>
                </select>

                <span class="input-group-addon"><a>*</a>所属分组</span>
                <select class="form-control" name="group" id="group" style="width: 300px;">
                    <option value="-1">请选择（下拉最多显示50个分组）</option>
                    {% for group in groups %}
                        <option value="{{ group.group_id }}">{{ group.group_name }}</option>
                    {% endfor %}
                </select>
            </div>
        </div>
        <div class="form-group addcase_class">
            <div class="input-group">
                <span class="input-group-addon"><a>*</a>预期结果</span>
                <input type="text" maxlength="100" class="form-control" name="expect_res" placeholder="预期结果，最多100个字符">
            </div>
            <p style="color: red; width: 800px;">预期结果支持or、and、not逻辑多重断言（不使用默认为模糊匹配），不区分大小写，具体格式如下：<br>
                or=x$y$z（说明：响应结果中只需要匹配到x、y、z三者中的一个即为匹配成功）<br>
                and=x$y$z（说明：响应结果中必须同时匹配到x、y、z三者的全部才为匹配成功）<br>
                not=x$y$z（说明：响应结果中如果匹配到x、y、z三者中的任意一个，即为匹配失败）
            </p>
        </div>
        <div class="form-group addcase_class">
            <div class="input-group">
                <span class="input-group-addon">header头</span>
                <textarea type="text" maxlength="3000" class="form-control" name="header" placeholder="请求的headers信息，最多3000个字符"></textarea>
            </div>
            <span style="color: red;">headers填写的格式为：key1#value1$key2#value2$…，不能有汉字，key必须含有字母。</span><br>
            <span style="color: red;">post请求常用传参格式：content-type#application/x-www-form-urlencoded</span><br>
            <span style="color: red;">get请求常用传参格式：accept#application/json$AUTOTEST#1</span>

        </div>
        <div class="form-group addcase_class">
            <div class="input-group">
                <span class="input-group-addon">备注信息</span>
                <textarea type="text" maxlength="1000" class="form-control" name="remark" placeholder="备注信息，最多1000个字符"></textarea>
            </div>
        </div>

        <div class="form-group addcase_class">
            <div class="input-group">
                <label><input type="radio" id="enable" name="status" value="1" checked="checked">启用</label><span>&nbsp;&nbsp;</span>
                <label><input type="radio" id="disable" name="status" value="0">禁用</label>
            </div>
        </div>
        <div class="form-group">
            <button type="button" class="btn btn-primary" id="submit">保存</button>
            <button type="button" class="btn btn-warning" id="debug-case-btn">调试</button>
        </div>
        <div class="form-group addcase_class">
                <textarea type="text" class="form-control" name="debug-info" placeholder="调试信息..." disabled="disabled"></textarea>
        </div>
    </form>

{% endblock %}